package com.pharmacy.controller;


import com.pharmacy.dto.CategoriesPageSelectDto;
import com.pharmacy.result.PageResult;
import com.pharmacy.result.Result;
import com.pharmacy.service.ExpiredDrugsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/admin/expiredDrugs")
@Slf4j
@Tag(name = "过期药物")
@CrossOrigin
public class ExpiredDrugsController {

    @Autowired
    ExpiredDrugsService expiredDrugsService;

    @Operation(summary = "过期药物分页查询")
    @GetMapping("/pageSelect")
    private Result<PageResult> pageSelectExpiredDrugs(CategoriesPageSelectDto categoriesPageSelectDto){
        log.info("分页查询过期药物{}",categoriesPageSelectDto);
        PageResult pageResult = expiredDrugsService.pageSelect(categoriesPageSelectDto);
        return Result.success(pageResult);
    }

    @Operation(summary = "删除过期药物")
    @DeleteMapping("/deleteExpiredDrugs")
    public Result deleteExpiredDrugs(Integer id){
        expiredDrugsService.deleteExpiredDrugs(id);
        return Result.success();
    }



}
